public class Main {
    public static void main(String[] args) {
        int[][] arr = new int[10][];
        for(int i =0;i < arr.length;i++){
            arr[i] = new int[i+1];
            for(int j = 0;j < arr[i].length;j++){
                if(j == 0 || j == arr[i].length - 1){
                    arr[i][j] = 1;
                }else{
                    arr[i][j] = arr[i-1][j-1] + arr[i-1][j];
                }
            }
        }
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.print(arr[i][j] + "\t");

            }
            System.out.println();
         /*   // 使用增强型for循环打印杨辉三角
            for (int[] row : arr) {  // 遍历每一行
                for (int num : row) {  // 遍历当前行的每个元素
                    System.out.print(num + "\t");
                }
                System.out.println();  // 换行
        */
        }
    }
}